import java.util.Vector;

public class Node {
	private Vector<Node> next;
	private Board board;
	int turnIndex;
	private String move;
	
	public Node(Board board, int turnIndex, String move)
	{
		this.board = board;
		this.next = new Vector<Node>();
		this.turnIndex = turnIndex;
		this.move = move;
	}
	
	public Node(Board board, Vector<Node> next, int turnIndex, String move)
	{
		this.board = board;
		this.next = next;
		this.turnIndex = turnIndex;
		this.move = move;
	}
	
	public String getMove()
	{
		return move;
	}
	
	public void setNext(Vector<Node> next)
	{
		this.next = next;
	}
	
	public int getTurnIndex()
	{
		return this.turnIndex;
	}
	
	public void addChild(Node node)
	{
		this.next.add(node);
	}
	
	public Board getBoard()
	{
		return this.board;
	}
	
	public Vector<Node> getNext()
	{
		return this.next;
	}
	
	public Node getChildForMove(Move move)
	{
		for (int i = 0; i<this.next.size();i++)
		{
			if (move.ToString().equals(this.next.elementAt(i).getMove()))
			{
				return this.next.elementAt(i);
			}
		}
		throw new NullPointerException();
	}
}
